/* 
 *   Copyright (c) 2021 Liu Bingyi
 *   MineSweeping is licensed under Mulan PSL v2.
 *   You can use this software according to the terms and conditions of the Mulan PSL v2.
 *   You may obtain a copy of Mulan PSL v2 at:
 *            http://license.coscl.org.cn/MulanPSL2
 *   THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 *   EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 *   MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 *   See the Mulan PSL v2 for more details.
 * 
 *   Author: LiuBingyi
 *   Email: cecillearofa@163.com
 *   Created at 2021/03/24 22:12:59
 */

package minesweeping;

public class Box {
    private int inner;
    private byte status = BOXCLOSE;
    public static final byte BOXOPEN = 0x00; // 0b 0000 0000
    public static final byte BOXCLOSE = 0x01; // 0b 0000 0001
    public static final byte BOXSEAL = 0x03; // 0b 0000 0011

    public Box() {
        inner = 0;
    }

    public Box(int inner) {
        this.inner = inner;
    }

    public int getInner() {
        return inner;
    }

    public void setInner(int inner) {
        this.inner = inner;
    }

    public byte getStatus() {
        return status;
    }

    public void sealBox() {
        if (isClose())
            status = BOXSEAL;
    }

    public void unsealBox() {
        if (isSeal())
            status = BOXCLOSE;
    }

    public void openBox() {
        if (isClose()) {
            status = BOXOPEN;
        }
    }

    public void closeBox() {
        if (isOpen())
            status = BOXCLOSE;
    }

    public boolean isClose() {
        return status == BOXCLOSE;
    }

    public boolean isOpen() {
        return status == BOXOPEN;
    }

    public boolean isSeal() {
        return status == BOXSEAL;
    }
}